<script type="text/javascript">
var http = false;

if(navigator.appName == "Microsoft Internet Explorer") {
  http = new ActiveXObject("Microsoft.XMLHTTP");
} else {
  http = new XMLHttpRequest();
} 




function replace() {
//http.onreadystatechange = sendData;
  http.open("GET", "wait1.php", true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      document.getElementById('foo').innerHTML = http.responseText;
    }
  }
  http.send(null);
}






</script>



<p><a href="javascript:replace()">Replace Text</a></p>
hello world!!!

<div id="foo">
  Hello, world!
</div>